package org.example.exception;

import org.example.pojo.Result;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.util.StringUtils; // 导入正确的 StringUtils 类

@RestControllerAdvice
public class GlobalExceptionHandler {
    public Result handleException(Exception e) {
        e.printStackTrace();
        return Result.error(StringUtils.hasLength(e.getMessage()) ? e.getMessage() : "操作失败");
    }
}